import { request } from '@/framework/utils/request-jdz';

export const boxPrintSuccess = (params) => {
  return request(
    {
      url: `/storage/box/instance/printed`,
      method: 'put',
      data: params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
export const boxSearch = (params) => {
  return request(
    {
      url: '/storage/box',
      method: 'get',
      params: params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
export const boxAdd = (params) => {
  return request(
    {
      url: '/storage/box',
      method: 'post',
      data: params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
export const boxPrint = (params) => {
  return request(
    {
      url: '/storage/box/instance/batch',
      method: 'post',
      data: params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
export const boxDelete = (id) => {
  return request(
    {
      url: `/storage/box/${id}`,
      method: 'delete',
    },
    {
      isGetDataDirectly: false,
    },
  );
};
export const boxUpdate = (params) => {
  return request(
    {
      url: '/storage/box',
      method: 'patch',
      data: params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};

export const getRealBox = (params) => {
  return request(
    {
      url: '/storage/box/instance',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
export const boxSearchAll = () => {
  const params = {
    paging: false,
    virtualBoxId: -1,
  };
  return request(
    {
      url: '/storage/box/no-paging',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
export const delBoxInfo = (id) => {
  return request(
    {
      url: `/storage/box/instance/${id}`,
      method: 'delete',
    },
    {
      isGetDataDirectly: false,
    },
  );
};

export const postInstanceAddV2 = (params) => {
  return request(
    {
      url: '/storage/box/instance/add/v2',
      method: 'post',
      data: params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
export const boxSearchInstance = (params, id) => {
  return request(
    {
      url: `/storage/box/instance/${id}/in-use`,
      method: 'get',
      params: params,
    },
    {
      isGetDataDirectly: false,
    },
  );
};
